home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / Open.data < prev    next >
Text File  |  1995-08-19  |  1KB  |  73 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. Open = {
  5.  
  6.     SHORT = {{ Open a filehandle }};
  7.  
  8.     DESCRIPTION = {{
  9.     Openes an AmigaDOS Filehandle on a
  10.     certain file. the filehandle must be
  11.     closed with 'Close'.
  12.     Open is necessary for all filehandle
  13.     commands like ReadLn, WriteLn or
  14.     Close.
  15.  
  16.      RESULT
  17.     The BPTR to the created Filehandle
  18.     }};
  19.  
  20.     NOTES = {{
  21.     ! Open is highly dangerous! Do not Use it, if !
  22.     ! U do not exactly know what U are doing!     !
  23.     }};
  24.  
  25.     EXAMPLES = {{
  26.     > set fh `Open T:writetest WRITE`
  27.     > WriteLn $fh This is a test
  28.     > Close $fh
  29.     > Unset fh
  30.     > cat T:writetest
  31.       This is a test
  32.     }};
  33.  
  34.     HISTORY = {{
  35.     21-02-95 b_noll created
  36.     21-02-95 b_noll added version/format-prefix/offset
  37.     20-03-95 b_noll corrected output
  38.     20-03-95 b_noll added args diagnostics
  39.     19-08-95 b_noll created .data file
  40.     }};
  41.  
  42.     Template = "FILE/A,READ/S,WRITE/S";
  43.     Arguments = {{
  44.     STRPTR file;
  45.     ULONG  read;
  46.     ULONG  write;
  47.     }};
  48.  
  49.     version = "1.1";
  50.  
  51.     body = {{
  52.         {
  53.         ULONG mode = MODE_OLDFILE;
  54.         BPTR  file;
  55.  
  56.         if (argv->write)
  57.             mode = argv->read ? MODE_READWRITE : MODE_NEWFILE;
  58.  
  59.         if (file = Open (argv->file, mode)) {
  60.             // MISSING:  REGISTER(file);
  61.             FPrintf (Output(), "%ld\n", file);
  62.             retval = RETURN_OK;
  63.         } else {
  64.             retval = RETURN_ERROR;
  65.         } /* if */
  66.         }
  67.     }};
  68.  
  69. };
  70.  
  71. #endif
  72.  
  73.